/*
 * @FilePath: \flutter_ducafecat_news_getx\lib\main.dart
 * @Date: 2022-07-11 14:53:48
 * @LastEditTime: 2022-07-12 10:52:04
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:flutter_ducafecat_news_getx/common/langs/translation_service.dart';
import 'package:flutter_ducafecat_news_getx/common/routers/pages.dart';
import 'package:flutter_ducafecat_news_getx/common/store/store.dart';
import 'package:flutter_ducafecat_news_getx/common/style/style.dart';
import 'package:flutter_ducafecat_news_getx/common/utils/utils.dart';
import 'package:flutter_ducafecat_news_getx/global.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

Future<void> main() async {
  await Global.init();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: Size(375, 812),

      ///原始
      // builder: (_,_c) =>
      //   RefreshConfiguration(
      //     headerBuilder: () => ClassicHeader(),
      //     footerBuilder: () => ClassicFooter(),
      //     hideFooterWhenNotFull: true,
      //     headerTriggerDistance: 80,
      //     maxOverScrollExtent: 100,
      //     footerTriggerDistance: 150,
      //     child: GetMaterialApp(
      //       title: 'News',
      //       theme: AppTheme.light,
      //       debugShowCheckedModeBanner: false,
      //       initialRoute: AppPages.INITIAL,
      //       getPages: AppPages.routes,
      //       builder: EasyLoading.init(),
      //       translations: TranslationService(),
      //       navigatorObservers: [AppPages.observer],
      //       localizationsDelegates: [
      //         GlobalMaterialLocalizations.delegate,
      //         GlobalWidgetsLocalizations.delegate,
      //         GlobalCupertinoLocalizations.delegate,
      //       ],
      //       supportedLocales: ConfigStore.to.languages,
      //       locale: ConfigStore.to.locale,
      //       fallbackLocale: Locale('en', 'US'),
      //       enableLog: true,
      //       logWriterCallback: Logger.write,
      //     ),
      //   ),
      builder: (_, _c) => GetMaterialApp(
        title: 'News',
        theme: AppTheme.light,
        debugShowCheckedModeBanner: false,
        initialRoute: AppPages.INITIAL,
        getPages: AppPages.routes,
        builder: EasyLoading.init(),
        translations: TranslationService(),
        navigatorObservers: [AppPages.observer],
        localizationsDelegates: [
          GlobalMaterialLocalizations.delegate,
          GlobalWidgetsLocalizations.delegate,
          GlobalCupertinoLocalizations.delegate,
        ],
        supportedLocales: ConfigStore.to.languages,
        locale: ConfigStore.to.locale,
        fallbackLocale: Locale('en', 'US'),
        enableLog: true,
        logWriterCallback: Logger.write,
      ),
    );
  }
}
